/**
 * copyright 2014 by luobiliu
 *
 * @file:       PunchAudioEngine.cpp
 * @author:     luobiliu
 * @version:    1.0
 * @date:       2014-8-4
 *
 */


#include "PunchAudioEngine.h"
#include "PunchSettingData.h"
#include "StaticData.h"
static PunchAudioEngine* _sharedEngine = NULL;
using namespace CocosDenshion;
USING_NS_CC;
void PunchAudioEngine::setBackgroundMusicVolume(float volume)
{
    SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(volume);
    PunchSettingData::sharedSettingData()->setMusicVolume(volume);
}
void PunchAudioEngine::setEffectsVolume(float volume)
{
    SimpleAudioEngine::sharedEngine()->setEffectsVolume(volume);
    PunchSettingData::sharedSettingData()->setSoundVolume(volume);
}
PunchAudioEngine* PunchAudioEngine::sharedEngine()
{
    if(_sharedEngine==NULL){
        _sharedEngine = new PunchAudioEngine();
        _sharedEngine->init();
    }
    return _sharedEngine;
}
bool PunchAudioEngine::init()
{
    this->preloadBackgroundMusic(STATIC_DATA_STRING("bg_music"));
    this->preloadEffect(STATIC_DATA_STRING("sound_button"));
    this->preloadEffect(STATIC_DATA_STRING("sound_shot"));

    this->setBackgroundMusicVolume(PunchSettingData::sharedSettingData()->getMusicVolume());
    this->setEffectsVolume(PunchSettingData::sharedSettingData()->getSoundVolume());
    
    return true;
}
void PunchAudioEngine::purge()
{

}
PunchAudioEngine::PunchAudioEngine()
{
    
}
PunchAudioEngine::~PunchAudioEngine()
{
    
}

